package cn.myschool.java79.test2;

import cn.myschool.java79.dao.ExamResultMapper;
import cn.myschool.java79.dao.StudentMapper;
import cn.myschool.java79.entity.ExamResult;
import cn.myschool.java79.pojo.Student2;
import cn.myschool.java79.util.MybatisUtil;
import org.apache.ibatis.session.SqlSession;

/**
 * @author oldliu
 * @since 1.0
 */
public class TestGetStuWithScore {
    public static void main(String[] args) {
        SqlSession s= MybatisUtil.get();

        try {
            StudentMapper mapper = s.getMapper(StudentMapper.class);
            Student2 st = mapper.getWithExams(5L);
            System.out.println("学生信息："+st);
            System.out.println("考过的：");
            for(ExamResult r:st.getExams())
            System.out.println(r);
        }finally {
            MybatisUtil.close(s);
        }
    }
}
